<?php 
/* themes the balances for a given user.
 * Available variables
 * $balances is an array of the form:
 * Array (
    [$cid] => Array (
      [cleared_balance] => themed quantity
      [pending_dif] => themed quantity
      [gross_in] => themed quantity
      [gross_out] => themed quantity
      [max_in] => themed quantity
      [max_out] => themed quantity
      [rating] => themed quantity
      [max] => themed quantity
      [min] => themed quantity
    )
  )
 * also $currencies = array() //generated by preprocess
 * plus the usual
 */
 $currency = array_pop($currencies);
 $balances = array_pop($balances);
 ?>
 <table class = "balances">
  <style>balances th{text-align:center}</style>
   <tr>
     <th colspan = "2"><?php print $currency->title; ?></th>
   </tr>
   <tr>
     <th><?php print t('Cleared balance') ?></th>
     <td><?php print $balances['cleared_balance']; ?>
   </tr>
   <tr>
     <th><?php print t('Pending Balance') ?></th>
     <td><?php print $balances['pending_dif']; ?>
   </tr>
   <tr>
     <th><?php print t('Total income') ?></th>
     <td><?php print $balances['gross_in']; ?>
   </tr>
   <tr>
     <th><?php print t('Spending limit') ?></th>
     <td><?php print $balances['max_out']; ?>
   </tr>
 </table>
